home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / org / flintparticles / particles / Particle.as next >
Encoding:
Text File  |  2011-10-17  |  2.4 KB  |  104 lines

  1. package org.flintparticles.particles
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.geom.ColorTransform;
  5.    import flash.geom.Matrix;
  6.    import flash.utils.Dictionary;
  7.    
  8.    public class Particle
  9.    {
  10.        
  11.       
  12.       private var _dictionary:Dictionary = null;
  13.       
  14.       public var rotation:Number = 0;
  15.       
  16.       public var energy:Number = 1;
  17.       
  18.       public var lifetime:Number = 0;
  19.       
  20.       public var scale:Number = 1;
  21.       
  22.       public var angVelocity:Number = 0;
  23.       
  24.       public var image:DisplayObject = null;
  25.       
  26.       public var velY:Number = 0;
  27.       
  28.       public var velX:Number = 0;
  29.       
  30.       public var color:uint = 4294967295;
  31.       
  32.       public var spaceSortX:uint;
  33.       
  34.       public var isDead:Boolean = false;
  35.       
  36.       public var x:Number = 0;
  37.       
  38.       public var y:Number = 0;
  39.       
  40.       public var age:Number = 0;
  41.       
  42.       public function Particle()
  43.       {
  44.          x = 0;
  45.          y = 0;
  46.          velX = 0;
  47.          velY = 0;
  48.          rotation = 0;
  49.          angVelocity = 0;
  50.          color = 4294967295;
  51.          scale = 1;
  52.          image = null;
  53.          lifetime = 0;
  54.          age = 0;
  55.          energy = 1;
  56.          isDead = false;
  57.          _dictionary = null;
  58.          super();
  59.       }
  60.       
  61.       public function get dictionary() : Dictionary
  62.       {
  63.          if(_dictionary == null)
  64.          {
  65.             _dictionary = new Dictionary();
  66.          }
  67.          return _dictionary;
  68.       }
  69.       
  70.       public function get colorTransform() : ColorTransform
  71.       {
  72.          return new ColorTransform((color >>> 16 & 255) / 255,(color >>> 8 & 255) / 255,(color & 255) / 255,(color >>> 24 & 255) / 255,0,0,0,0);
  73.       }
  74.       
  75.       public function initialize() : void
  76.       {
  77.          x = 0;
  78.          y = 0;
  79.          velX = 0;
  80.          velY = 0;
  81.          rotation = 0;
  82.          angVelocity = 0;
  83.          color = 4294967295;
  84.          scale = 1;
  85.          lifetime = 0;
  86.          age = 0;
  87.          energy = 1;
  88.          isDead = false;
  89.          image = null;
  90.          spaceSortX = 0;
  91.          _dictionary = null;
  92.       }
  93.       
  94.       public function get matrixTransform() : Matrix
  95.       {
  96.          var _loc1_:Number = NaN;
  97.          var _loc2_:Number = NaN;
  98.          _loc1_ = scale * Math.cos(rotation);
  99.          _loc2_ = scale * Math.sin(rotation);
  100.          return new Matrix(_loc1_,_loc2_,-_loc2_,_loc1_,x,y);
  101.       }
  102.    }
  103. }
  104.